package com.itmuyue.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itmuyue.demo.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
//    查询所有用户收藏
    @Select("select * from user")
    @Results(
            {
                    @Result(column = "user_id",property = "user_id"),
                    @Result(column = "username",property = "username"),
                    @Result(column = "password",property = "password"),
                    @Result(column = "email",property = "email"),
                    @Result(column = "register_time",property = "register_time"),
                    @Result(column = "avater",property = "avatar"),
                    @Result(column = "user_type",property = "user_type"),
                    @Result(column = "user_id",property = "user_collectionsList",javaType = List.class,
                                 many=@Many(select = "com.itmuyue.demo.mapper.user_collectionsMapper.selectByUid")
                    )
            }
    )
    List<User> selectAllUserAndCollections();


}
